package Vistas;
import java.awt.Image;
import java.io.File;

import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTable;

import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JScrollPane;
import javax.swing.WindowConstants;
import javax.swing.table.AbstractTableModel;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableModel;
import javax.swing.SwingUtilities;

import Controlador.CCalendario;



/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class VCalendario extends javax.swing.JFrame {
	private JLabel lblimagen;

	public VCalendario() {
		super();
		initGUI();
		CCalendario controlador = new CCalendario(this);
		btnGenerar.addActionListener(controlador);
		btnSalir.addActionListener(controlador);
		btnposiciones.addActionListener(controlador);
	}
	
	ImageIcon icon= new ImageIcon(getClass().getResource("imagenes" + File.separator + "bannerPepsi.PNG"));

	Image img = icon.getImage();
    Image newimg = img.getScaledInstance(596, 101,  java.awt.Image.SCALE_SMOOTH);
	ImageIcon newIcon = new ImageIcon(newimg);
	private JButton btnposiciones;
	private JTable tablaResultados;
	private JPanel paneltabla;
	private JButton btnSalir;
	private JButton btnGenerar;

	private void initGUI() {
		try {
			setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
			getContentPane().setLayout(null);
			getContentPane().setBackground(new java.awt.Color(0,0,255));
			this.setTitle("Calendario");
			{
				lblimagen = new JLabel();
				getContentPane().add(lblimagen);
				lblimagen.setBounds(0, 0, 596, 101);
				lblimagen.setIcon(newIcon);
			}
			{
				btnGenerar = new JButton();
				getContentPane().add(btnGenerar);
				btnGenerar.setText("Generar Calendario");
				btnGenerar.setBounds(43, 333, 144, 26);
			}
			
				
			{
				btnSalir = new JButton();
				getContentPane().add(btnSalir);
				btnSalir.setText("Salir");
				btnSalir.setBounds(435, 333, 116, 26);
			}
			{paneltabla = new JPanel();
			getContentPane().add(paneltabla);
			paneltabla.setBounds(43, 134, 508, 187);
			paneltabla.setLayout(null);

				JScrollPane scpListado = new JScrollPane();
			paneltabla.add(scpListado);
			scpListado.setBounds(7, 5, 495, 176);

				{
					
					tablaResultados = new JTable();
					
					scpListado.setViewportView(tablaResultados);
				
				}
			}
			{
				btnposiciones = new JButton();
				getContentPane().add(btnposiciones);
				btnposiciones.setText("Tabla de Posiciones");
				btnposiciones.setBounds(227, 332, 167, 28);
			}
			pack();
			this.setSize(604, 408);
			setVisible(true);
			this.setResizable(false);
		} catch (Exception e) {
		    //add your error handling code here
			e.printStackTrace();
		}
	}
	
	public void setListado(AbstractTableModel abstractTableModel){
		tablaResultados.setModel(abstractTableModel);
	}
}
